package com.project.lk.nurseapp.bloodglucose.presenter;

import com.project.lk.nurseapp.base.BaseApi;
import com.project.lk.nurseapp.base.BasePresenter;
import com.project.lk.nurseapp.base.ModelPresenterBridge;
import com.project.lk.nurseapp.bloodglucose.model.PostGlucoseModel;

import java.util.List;

/**
 * 功能介绍：
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */
public class PostGlucosePresenter extends BasePresenter<IPostGlucoseView> implements ModelPresenterBridge{

    PostGlucoseModel postGlucoseModel;
    public PostGlucosePresenter(IPostGlucoseView view){
        postGlucoseModel=new PostGlucoseModel();
        postGlucoseModel.setBridge(this);
        addView(view);
    }

    public void postGlucoseDate(String url, String bloodSugar, String testTesult, String recordTime,String timeType){
        postGlucoseModel.postLoadJson(url,bloodSugar,testTesult,recordTime,timeType);
    }
    @Override
    public void bridge(int action, List list) {
        if (view!=null) {
            switch (action){
                case BaseApi.post_glucose_success:
                        view.postSuccess();
                    break;
                case BaseApi.post_glucose_fail:
                        view.postFail();
                    break;
            }
        }
    }
}
